<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<div class="map"></div>

<button class="start">开始</button>
<button class="stop">停止</button>
<script src="./map.js"></script>
<script src="./game.js"></script>
<script src="./food.js"></script>
<script src="./snake.js"></script>

<script>
const g = new Game('.map')
//获取开始按钮
let startBtn = document.querySelector('.start')
//绑定点击事件
startBtn.onclick = ()=>g.start()
//获取结束按钮
let stopBtn = document.querySelector('.stop')
//绑定点击事件
stopBtn.onclick = ()=>g.stop()
</script>